// 1.创建koa对象
const Koa = require('koa')
const app = new Koa()

// 2.编写响应函数(中间件)
// context: 上下文, web容器, context.request context.response
// next: 下一个中间件
const duration = require('./middleware/koa_response_duration')
app.use(duration)

const header = require('./middleware/koa_response_header')
app.use(header)

const data = require('./middleware/koa_response_data')
app.use(data)
// 3.绑定端口号3000
app.listen(3000)

const webSocketService = require('./services/websocket_services')
webSocketService.listen()